
import axios from 'axios'
const baseUrl = 'http://121.42.230.80'
const http = (method = '', url = '', data = {}, params = {}) => {
	url = baseUrl + url
	return new Promise((reolve, reject) => {
		axios.request({
			url,
			params,
			method,
			headers: {
				'Content-Type': 'application/json; charset=UTF-8',
				'Authorization': sessionStorage.getItem('token')
			},
			data
		}).then((res) => {
			reolve(res.data)
		}).catch((err) => {
			reject(err)
		})
	})
}

const get = (url, params) => http('GET', url, null, params)
const post = (url, data) => http('POST', url, data, null)

export default {
  get,
  post

}

